﻿using System;
using System.IO;
using System.Windows.Forms;

namespace MusicPlayer
{
    internal static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            PlayerContext playerContext = null;
            if (!File.Exists(Properties.Resources.CONFIG_FILE))
            {
                var fileStream = File.CreateText(Properties.Resources.CONFIG_FILE);
                playerContext = new PlayerContext();
                fileStream.Write(XmlUtil.SerializeObject<PlayerContext>(playerContext));
                fileStream.Close();
            }
            string xml = File.ReadAllText(Properties.Resources.CONFIG_FILE);
            playerContext = XmlUtil.DeserializeObject<PlayerContext>(xml);
            Application.Run(new MainFrm(playerContext));
        }
    }
}
